//从vue-router这个依赖库中导入createRouter()函数, createWebHistory()函数
import {createRouter, createWebHistory} from "vue-router";
import {getTokenKey} from "../util/util.js";

//定义一个变量
let router = createRouter({
    //路由历史
    history: createWebHistory(),
    //配置路由，是一个数组，里面可以配置多个路由
    routes: [

        {
            path: '/',
            component: () => import('../views/indexView.vue'),
        },
        {
            path: '/user/login',
            component: () => import('../views/UserLoginView.vue'),
        },
        {
            path: '/user/register',
            component: () => import('../views/RegisterView.vue'),
        },

        {
            path: '/shoppingCart',
            component: () => import('../views/ShoppingCartView.vue'),
        },
        // {
        //     path: '/GoodsDetail',
        //     component: () => import('../views/GoodsDetailView.vue'),
        // },
        {
            path: '/GoodsDetail/:productId',
            component: () => import('../views/GoodsDetailView.vue'),
        },
        {
            path: '/classify',
            component: () => import('../views/ClassifyView.vue'),
        },
        {
            path: '/deliverAddress',
            component: () => import('../views/deliverAddressView.vue'),
        },
        {
            path: '/order',
            component: () => import('../views/OrderView.vue'),
        },
    ]
})


//导出创建的路由对象
export default router;